package com.example.demo.config;

import com.example.demo.component.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 马拉圈
 * Date: 2023-08-24
 * Time: 10:13
 */
@Configuration//不是Configurable！
public class AppConfig implements WebMvcConfigurer {

//
//    @Override
//    public void configurePathMatch(PathMatchConfigurer configurer) {
//        configurer.addPathPrefix("api", c -> true);
//    }

    @Autowired
    private UserInterceptor userInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(userInterceptor)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/blog_login.html")
//                .excludePathPatterns("/test/login")
//                .excludePathPatterns("/**/*.png")
//                .excludePathPatterns("/**/*.gif")
//                .excludePathPatterns("/**/*.css")
//                .excludePathPatterns("/**/*.js")
//                .excludePathPatterns("/**/*.jpg")
//                .excludePathPatterns("/editor.md")
        ;
    }

}
